package com.example.langchain4jdemo.modelConfig;

import dev.langchain4j.community.model.dashscope.QwenChatModel;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import dev.langchain4j.service.AiServices;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.spring.AiService;
import org.springframework.context.annotation.Configuration;

/**
 *配置类，用于配置模型(apiKey,会话记忆，提示词等)
 */
@Configuration
public class ChatModeConfig {
    ChatMemory chatMemory = MessageWindowChatMemory.withMaxMessages(10);

    public QwenChatModel qwenModel = QwenChatModel.builder()
            .apiKey("sk-75a2d5423c1e46f2855b9244b02fb4f1")
            .modelName("qwen-vl-plus")
            .build();


    public interface Assistant {
        //@SystemMessage(fromResource = "static/girlfriend-prompt.txt")
        String chat(String userMessage);
    }
   public Assistant assistant = AiServices.builder(Assistant.class)
            .chatModel(qwenModel)
            .chatMemory(chatMemory)
            .build();






}






